const quoteModel = require("../models/quoteModel");

module.exports = {
  async getOneQuote() {
    const quoteList = await quoteModel.find();
    const random = Math.floor(Math.random() * quoteList.length);
    return quoteList[random];
  },
  async createQuote(quote) {
    return await quoteModel.create(quote);
  },

  async deleteQuote(id) {
    return await quoteModel.deleteOne({ _id: id });
  },
  async getAllQuote() {
    return await quoteModel.find();
  },
};
